package com.jiangyg.devtools.ui.table.cell;

import org.apache.commons.lang.BooleanUtils;

import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;

/**
 * 类描述：复选框渲染器
 *
 * @author jiangyg
 * @version 1.0
 * @date 2023年08月28日
 */
public class CheckBoxCellRenderer implements TableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table,
                                                   Object value,
                                                   boolean isSelected,
                                                   boolean hasFocus,
                                                   int row, int column) {
        final boolean selected = BooleanUtils.toBoolean(String.valueOf(value));
        return new CheckBoxCellComponent(selected);
    }

}
